home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / util / st / part01
Encoding:
Internet Message Format  |  1990-06-04  |  17.7 KB

  1. Path: xanth!cs.odu.edu!Amiga-Request
  2. From: Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v90i176: st - interrupt-driven serial i/o testbed, Part01/01
  5. Message-ID: <12705@xanth.cs.odu.edu>
  6. Date: 4 Jun 90 00:05:36 GMT
  7. Sender: tadguy@cs.odu.edu
  8. Reply-To: jcs@crash.uucp
  9. Lines: 747
  10. Approved: tadguy@cs.odu.edu (Tad Guy)
  11. X-Mail-Submissions-To: Amiga@cs.odu.edu
  12. X-Post-Discussions-To: comp.sys.amiga
  13.  
  14. Submitted-by: jcs@crash.uucp
  15. Posting-number: Volume 90, Issue 176
  16. Archive-name: util/st/part01
  17.  
  18.   This code directly accesses the hardware and achieves very high
  19. baud rates without errors.  This code should be legal if the serial
  20. device is first opened and exclusive access is granted.  Speeds of
  21. over 130k baud between a stock, nofastmem 500 and a 25mhz GVP 68030
  22. have been achieved.  The '030 Amiga can go much faster; it can read
  23. at least 223,720 baud.  The 500 poops out at 132,575 baud.  Writing
  24. fast is no problem, reading eats up some bandwidth, and is thus
  25. the bottleneck.  Polled I/O (yuk) can yield faster rates. These
  26. baud rates were accomplished with a direct 2,3,7 wire, 50 foot
  27. shielded cable.  Max baud rates may vary depending on cable and
  28. hardware configurations.
  29.  
  30. #!/bin/sh
  31. # This is a shell archive.  Remove anything before this line, then unpack
  32. # it by saving it into a file and typing "sh file".  To overwrite existing
  33. # files, type "sh file -c".  You can also feed this as standard input via
  34. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  35. # will see the following message at the end:
  36. #        "End of archive 1 (of 1)."
  37. # Contents:  input.c input.h inputhandler.a makefile readme serial.a
  38. #   st.c
  39. # Wrapped by tadguy@xanth on Sun Jun  3 20:05:27 1990
  40. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  41. if test -f 'input.c' -a "${1}" != "-c" ; then 
  42.   echo shar: Will not clobber existing file \"'input.c'\"
  43. else
  44. echo shar: Extracting \"'input.c'\" \(2035 characters\)
  45. sed "s/^X//" >'input.c' <<'END_OF_FILE'
  46. X/* input.c
  47. X   created by John Schultz, 10-Sep-89
  48. X   
  49. X*/
  50. X
  51. X#include <exec/types.h>
  52. X#include <exec/io.h>  
  53. X#include <exec/ports.h>
  54. X#include <exec/interrupts.h>  
  55. X#include <proto/exec.h>
  56. X#include <proto/graphics.h>
  57. X#include <devices/input.h>
  58. X#include <devices/inputevent.h>
  59. X#include "input.h"
  60. X
  61. Xunsigned short volatile raw; /* raw key value */
  62. X
  63. Xstruct MsgPort indevport;
  64. Xstruct MsgPort * indevportptr;
  65. Xstruct IOStdReq * inreqblockptr;
  66. Xstruct Interrupt inhandler;
  67. Xstruct InputEvent * eventp;
  68. X
  69. Xextern void totalinput();
  70. X
  71. Xint createti(void) {
  72. X
  73. X  indevportptr = CreatePort("indevport",0);
  74. X  if (!indevportptr) {
  75. X    return 0;
  76. X  }
  77. X
  78. X  inreqblockptr = CreateStdIO((struct MsgPort *)indevportptr);
  79. X  if (!inreqblockptr) {
  80. X   DeletePort(indevportptr); 
  81. X   return 0;
  82. X  }
  83. X
  84. X  inhandler.is_Data = (APTR)&raw;
  85. X  inhandler.is_Code = totalinput;
  86. X  inhandler.is_Node.ln_Pri = 51; /* One ahead of Intuition */
  87. X
  88. X  if (OpenDevice("input.device",0L,
  89. X                 (struct IORequest *)inreqblockptr,0L)) {
  90. X    DeletePort(indevportptr);
  91. X    DeleteStdIO(inreqblockptr);
  92. X    return 0; 
  93. X  }
  94. X
  95. X  inreqblockptr->io_Command = IND_ADDHANDLER;
  96. X  inreqblockptr->io_Data    = (APTR)&inhandler;
  97. X  
  98. X  if (DoIO((struct IORequest *)inreqblockptr)) {
  99. X    DeletePort(indevportptr);
  100. X    DeleteStdIO(inreqblockptr);
  101. X    CloseDevice((struct IORequest *)inreqblockptr);
  102. X    return 0;
  103. X  }
  104. X
  105. X  GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",0);
  106. X  if(!GfxBase) {
  107. X    DeletePort(indevportptr);
  108. X    DeleteStdIO(inreqblockptr);
  109. X    CloseDevice((struct IORequest *)inreqblockptr);
  110. X    return 0;
  111. X  }
  112. X  FreeSprite(0);
  113. X
  114. X  CloseLibrary((struct Library *)GfxBase);
  115. X
  116. X  return 1;  
  117. X
  118. X} /* end createti */
  119. X
  120. Xvoid deleteti(void) {
  121. X
  122. X  if ((indevportptr) && (inreqblockptr)) {
  123. X    inreqblockptr->io_Command = IND_REMHANDLER;
  124. X    inreqblockptr->io_Data = (APTR)&inhandler;
  125. X    DoIO((struct IORequest *)inreqblockptr);
  126. X    CloseDevice((struct IORequest *)inreqblockptr);
  127. X    DeleteStdIO(inreqblockptr);
  128. X    DeletePort(indevportptr);
  129. X  } /* end if */
  130. X
  131. X} /* END deleteti */
  132. X
  133. X
  134. X/* END input.c */
  135. END_OF_FILE
  136. if test 2035 -ne `wc -c <'input.c'`; then
  137.     echo shar: \"'input.c'\" unpacked with wrong size!
  138. fi
  139. # end of 'input.c'
  140. fi
  141. if test -f 'input.h' -a "${1}" != "-c" ; then 
  142.   echo shar: Will not clobber existing file \"'input.h'\"
  143. else
  144. echo shar: Extracting \"'input.h'\" \(241 characters\)
  145. sed "s/^X//" >'input.h' <<'END_OF_FILE'
  146. X/* input.h - total input
  147. X   created by John Schultz, 10-Sep-89
  148. X*/
  149. X
  150. X#ifndef INPUTTI
  151. X#define INPUTTI
  152. X
  153. Xextern unsigned short volatile raw;  /* raw key input */
  154. X
  155. Xextern int createti(void);
  156. X
  157. Xextern void deleteti(void);
  158. X
  159. X#endif
  160. X
  161. X/* end input.h */
  162. END_OF_FILE
  163. if test 241 -ne `wc -c <'input.h'`; then
  164.     echo shar: \"'input.h'\" unpacked with wrong size!
  165. fi
  166. # end of 'input.h'
  167. fi
  168. if test -f 'inputhandler.a' -a "${1}" != "-c" ; then 
  169.   echo shar: Will not clobber existing file \"'inputhandler.a'\"
  170. else
  171. echo shar: Extracting \"'inputhandler.a'\" \(418 characters\)
  172. sed "s/^X//" >'inputhandler.a' <<'END_OF_FILE'
  173. X; Input Handler
  174. X; created by John Schultz, 17-Sep-89
  175. X
  176. X    section    "TotalInput",code
  177. X
  178. X    xdef    _totalinput
  179. X
  180. X; Input event structure offsets
  181. X
  182. XIECLASS    equ    4
  183. XIECODE    equ    6
  184. X
  185. X; A0 = inputevent pointer
  186. X; A1 = data pointer
  187. X
  188. X_totalinput:
  189. X    cmp.b    #1,IECLASS(A0)    ; event->ie_Class == IECLASS_RAWKEY ?
  190. X    bne.b    notrawkey
  191. X    move.w    IECODE(A0),(A1)    ; raw = event->ie_Code
  192. Xnotrawkey:
  193. X    moveq.l    #0,D0        ; don't pass events to intuition
  194. X    rts
  195. X
  196. X    END
  197. X
  198. END_OF_FILE
  199. if test 418 -ne `wc -c <'inputhandler.a'`; then
  200.     echo shar: \"'inputhandler.a'\" unpacked with wrong size!
  201. fi
  202. # end of 'inputhandler.a'
  203. fi
  204. if test -f 'makefile' -a "${1}" != "-c" ; then 
  205.   echo shar: Will not clobber existing file \"'makefile'\"
  206. else
  207. echo shar: Extracting \"'makefile'\" \(352 characters\)
  208. sed "s/^X//" >'makefile' <<'END_OF_FILE'
  209. X# serial makefile, created by John Schultz, 17-Sep-89
  210. X
  211. Xst: st.o serial.o input.o inputhandler.o
  212. X  blink from lib:c.o+st.o+serial.o+input.o+inputhandler.o to st \
  213. X             lib lib:lc.lib sc sd nd
  214. X
  215. Xst.o: st.c
  216. X  lc -O st.c
  217. X
  218. Xserial.o: serial.a
  219. X  asm serial.a
  220. X
  221. Xinput.o: input.h input.c
  222. X  lc input.c
  223. X
  224. Xinputhandler.o: inputhandler.a
  225. X  asm inputhandler.a
  226. X
  227. END_OF_FILE
  228. if test 352 -ne `wc -c <'makefile'`; then
  229.     echo shar: \"'makefile'\" unpacked with wrong size!
  230. fi
  231. # end of 'makefile'
  232. fi
  233. if test -f 'readme' -a "${1}" != "-c" ; then 
  234.   echo shar: Will not clobber existing file \"'readme'\"
  235. else
  236. echo shar: Extracting \"'readme'\" \(2076 characters\)
  237. sed "s/^X//" >'readme' <<'END_OF_FILE'
  238. X
  239. X                Interrupt-driven Serial I/O Testbed
  240. X                          by John Schultz
  241. X                              4/16/90
  242. X
  243. X  This code directly accesses the hardware and achieves very high
  244. Xbaud rates without errors.  This code should be legal if the serial
  245. Xdevice is first opened and exclusive access is granted.  Speeds of
  246. Xover 130k baud between a stock, nofastmem 500 and a 25mhz GVP 68030
  247. Xhave been achieved.  The '030 Amiga can go much faster; it can read
  248. Xat least 223,720 baud.  The 500 poops out at 132,575 baud.  Writing
  249. Xfast is no problem, reading eats up some bandwidth, and is thus
  250. Xthe bottleneck.  Polled I/O (yuk) can yield faster rates. These
  251. Xbaud rates were accomplished with a direct 2,3,7 wire, 50 foot
  252. Xshielded cable.  Max baud rates may vary depending on cable and
  253. Xhardware configurations.
  254. X  The current test code, ST (Serial Test), writes characters typed
  255. Xon the keyboard 10 times.  Errors at high speed show up when less
  256. Xthan 10 characters are received or funny characters are inserted.
  257. X  I can run DNet and leave it running while I run this code!  DNet
  258. Xmust be idling, and the baud rate must be the same as DNet's (usually
  259. X19200) the last time you run ST.  This is very useful as quiting and
  260. Xrestarting DNet is not necessary.
  261. X  Part of the original assembly code came from the Amiga Transactor,
  262. XSeptember 1989: Volume 2, Issue 6,pp 42-44, by Mike Schwartz.  The 
  263. Xexample changed the AutoVectors directly, and had a few typos. I use
  264. XSetIntVector(), and do things a little differently with the rbf and
  265. Xtbe code. This was pretty much the first assembly language program I
  266. Xwrote, so experts feel free to point out improvements. 
  267. X  I wrote the code using Lattice 5.04.  I currently use the Cape
  268. Xor Devpac assemblers for speed, but for this example used Lattice's
  269. Xasm (everyone with Lattice should have it).
  270. X
  271. X  As always, please point out any optimizations, errors, or illegal
  272. Xacts committed in this code. If you enhance the code, please email me
  273. Xa copy.
  274. X
  275. X  Use this code as you wish; no strings, ropes, cables, or
  276. Xbungee cords attached.
  277. X
  278. X
  279. X
  280. X    John
  281. END_OF_FILE
  282. if test 2076 -ne `wc -c <'readme'`; then
  283.     echo shar: \"'readme'\" unpacked with wrong size!
  284. fi
  285. # end of 'readme'
  286. fi
  287. if test -f 'serial.a' -a "${1}" != "-c" ; then 
  288.   echo shar: Will not clobber existing file \"'serial.a'\"
  289. else
  290. echo shar: Extracting \"'serial.a'\" \(5691 characters\)
  291. sed "s/^X//" >'serial.a' <<'END_OF_FILE'
  292. X; Serial.a
  293. X; created by John Schultz, 17-Sep-89
  294. X; last modified 17-April-90
  295. X
  296. X    section    Serial,CODE
  297. X
  298. X    xref    _raw
  299. X
  300. X    xdef    _baudper
  301. X    xdef    _openserial
  302. X    xdef    _closeserial
  303. X    xdef    _sendser
  304. X    xdef    _readser
  305. X    xdef    _checkser
  306. X    xdef    _rawtoascii
  307. X    xdef    _sendsernobuff
  308. X
  309. X
  310. X_LVOSetIntVector equ    $FFFFFF5E
  311. X
  312. XESCAPE        equ    69        ; input-handler rawkey code
  313. X
  314. XCLOCK        equ    3579545
  315. X_baudper    dc.w     (CLOCK/19200)-1    ; defaualt
  316. X
  317. XCUSTOM        equ    $dff000
  318. XSERDATR        equ    $000018
  319. XSERDAT        equ    $000030
  320. XSERPER        equ    $000032
  321. X
  322. XINTENA        equ    $00009a
  323. XINTENAR        equ    $00001c
  324. XINTREQ        equ    $00009c
  325. X
  326. XTBEQSIZE    equ    128        ; buffer size in bytes,
  327. XRBFQSIZE    equ    128        ; increase or decrease as needed
  328. X
  329. XLED        equ    $bfe001        ; toggle power led, audio filter
  330. X
  331. Xledroll        dc.b    %00010001    ; flash every 4 bytes
  332. Xledpad        dc.b    0
  333. X
  334. Xoldintena    dc.w    0
  335. X
  336. Xtbequeue    ds.b    TBEQSIZE    ; circular queue
  337. Xtbeqend
  338. Xtbehead        dc.l    tbequeue
  339. Xtbetail       dc.l    tbequeue
  340. X
  341. Xoldtbeinterrupt    dc.l    0
  342. Xoldrbfinterrupt    dc.l    0
  343. X
  344. Xtbeinterrupt
  345. X    dc.l    0    ; ln_succ
  346. X    dc.l    0    ; ln_prec
  347. X    dc.b    2    ; NT_INTERRUPT
  348. X    dc.b    127    ; ln_pri
  349. X    dc.l    0    ; ln_name
  350. X    dc.l    tbehead    ; is_data
  351. X    dc.l    tbehandler ; is_code
  352. X
  353. Xrbfinterrupt
  354. X    dc.l    0    ; ln_succ
  355. X    dc.l    0    ; ln_prec
  356. X    dc.b    2    ; NT_INTERRUPT
  357. X    dc.b    127    ; ln_pri
  358. X    dc.l    0    ; ln_name
  359. X    dc.l    rbftail    ; is_data
  360. X    dc.l    rbfhandler ; is_code
  361. X
  362. X
  363. Xtbehandler    
  364. X    move.w    #1,INTREQ(a0)        ; clear TBE interrupt
  365. X    move.l    (a1),a1            ; a1 = tbehead, (a1) = pointer
  366. X    cmp.l    tbetail,a1        ; now a1 = pointer
  367. X    beq.b    99$
  368. X    move.w    SERDATR(a0),d0        ; check to make sure emtpy
  369. X    btst    #13,d0
  370. X    beq.b    99$
  371. X    move.w    #$100,d0
  372. X    move.b    (a1)+,d0        ; get byte from queue
  373. X    move.w    d0,SERDAT(a0)        ; send byte
  374. X    cmpa.l    #tbeqend,a1
  375. X    bne.b    10$
  376. X    lea    tbequeue(pc),a1
  377. X10$    move.l    a1,tbehead
  378. X99$
  379. X    rts
  380. X
  381. Xrbfqueue    ds.b    RBFQSIZE
  382. Xrbfqend    
  383. Xrbfhead        dc.l    rbfqueue
  384. Xrbftail        dc.l    rbfqueue
  385. X
  386. Xrbfhandler
  387. X    move.w    SERDATR(a0),d0        ; a0 = custom
  388. X    move.w    #$800,INTREQ(a0)    ; clear RBF interrupt
  389. X    move.l    (a1),a0            ; a1 = rbftail, get pointer
  390. X    move.b    d0,(a0)+        ; write byte to buffer
  391. X    cmpa.l    #rbfqend,a0
  392. X    bne.b    10$
  393. X    lea    rbfqueue(pc),a0
  394. X10$    move.l    a0,(a1)            ; a1 = rbftail
  395. X
  396. X;99$
  397. X;    move.b    ledroll(pc),d0        ; remove from 99$-100$ for more
  398. X;    rol.b    #1,d0            ; speed
  399. X;    move.b    d0,ledroll
  400. X;    btst    #1,d0
  401. X;    beq.b    100$
  402. X;    bchg.b    #1,LED            ; toggle power led / audio filter
  403. X;100$
  404. X    rts
  405. X
  406. X_openserial
  407. X    move.l    a6,-(sp)
  408. X    lea    CUSTOM,a0
  409. X    move.w    #$4000,INTENA(a0)    ; disable
  410. X    move.l    $4,a6            ; execbase
  411. X    lea    rbfinterrupt(pc),a1
  412. X    moveq.l    #11,d0
  413. X    jsr    _LVOSetIntVector(a6)
  414. X    move.l    d0,oldrbfinterrupt
  415. X    lea    tbeinterrupt(pc),a1
  416. X    moveq.l    #0,d0
  417. X    jsr    _LVOSetIntVector(a6)
  418. X    move.l    d0,oldtbeinterrupt
  419. X
  420. X    lea    CUSTOM,a0
  421. X    move.w    _baudper,SERPER(a0)    ; set period
  422. X
  423. X    move.w    #$3fff,$bfd0fe        ; init handshake lines
  424. X    move.w    INTENAR(a0),oldintena
  425. X    move.w    #$8801,INTENA(a0)    ; turn on RBF and TBE INTENA
  426. X    move.w    #$0801,INTREQ(a0)    ; clear RBF and TBE INTREQ
  427. X    move.w    #$c000,INTENA(a0)    ; enable
  428. X    move.l    (sp)+,a6
  429. X    rts
  430. X
  431. X
  432. X_closeserial
  433. X    move.l    a6,-(sp)
  434. X    lea    CUSTOM,a0
  435. X    move.w    #$4000,INTENA(a0)    ; disable
  436. X    move.l    $4,a6            ; execbase
  437. X    move.l    oldrbfinterrupt,a1
  438. X    moveq.l    #11,d0
  439. X    jsr    _LVOSetIntVector(a6)
  440. X    move.l    oldtbeinterrupt,a1
  441. X    moveq.l    #0,d0
  442. X    jsr    _LVOSetIntVector(a6)
  443. X
  444. X    lea    CUSTOM,a0
  445. X    move.w    #$0801,INTENA(a0)    ; turn off RBF and TBE INTENA
  446. X    move.w    oldintena,d0
  447. X    and.w    #$0801,d0        ; mask for bit 11 and bit 1.
  448. X    bset    #15,d0            ; set/clr = 1 (set)
  449. X    move.w    d0,INTENA(a0)         ; reset old RBF and TBE INTENA
  450. X
  451. X    bclr.b    #1,LED
  452. X
  453. X    move.w    #$0801,INTREQ(a0)    ; clear RBF and TBE INTREQ
  454. X    move.w    #$c000,INTENA(a0)    ; enable
  455. X    move.l    (sp)+,a6
  456. X    rts
  457. X
  458. X_sendser
  459. X    lea    CUSTOM,a0
  460. X    move.w    #$4000,INTENA(a0)
  461. X
  462. X    move.l    tbetail,a1
  463. X    cmpa.l    tbehead,a1
  464. X    beq.b    5$
  465. X    move.w    #$8001,INTREQ(a0)    ; generate a tbe interrupt
  466. X5$
  467. X    move.b    d0,(a1)+        ; queue up byte
  468. X    cmpa.l    #tbeqend,a1
  469. X    bne.b    10$
  470. X    lea    tbequeue(pc),a1
  471. X10$    move.l    a1,tbetail
  472. X    
  473. X    move.w    #$c000,INTENA(a0)
  474. X    rts
  475. X
  476. X
  477. X; send byte in d0 to serial port, non-buffered.
  478. X_sendsernobuff
  479. X    lea    CUSTOM,a0
  480. X    move.w    #$4000,INTENA(a0)
  481. X1$    move.w    SERDATR,d1
  482. X    btst    #13,d1            ; check TBE
  483. X    beq.b    1$            ; buffer busy
  484. X    
  485. X    move.w    #$100,d1
  486. X    move.b    d0,d1
  487. X    move.w    d1,SERDAT(a0)
  488. X2$    move.w    SERDATR(a0),d1
  489. X    btst    #13,d1            ; check TBE
  490. X    beq.b    2$            ; buffer busy
  491. X    move.w    #$001,INTREQ(a0)    ; clear TBE interrupt
  492. X
  493. X    move.w    #$c000,INTENA(a0)
  494. X    rts
  495. X
  496. X
  497. X; uses a0
  498. X_readser
  499. X    cmp.w    #ESCAPE,_raw    ; quits on ESC from input handler
  500. X    beq.b    20$
  501. X    move.l    rbfhead,a0
  502. X    cmpa.l    rbftail,a0
  503. X    beq.b    _readser
  504. X    move.b    (a0)+,d0
  505. X    cmpa.l    #rbfqend,a0
  506. X    bne.b    10$
  507. X    lea    rbfqueue(pc),a0
  508. X10$    move.l    a0,rbfhead
  509. X20$
  510. X    rts
  511. X
  512. X_checkser
  513. X    move.l    rbfhead,a0
  514. X    cmpa.l    rbftail,a0
  515. X    bne.b    dataisin
  516. X    moveq.l    #0,d0
  517. X    rts
  518. Xdataisin
  519. X    moveq.l    #1,d0
  520. X    rts
  521. X
  522. X
  523. X; rawkey in d0
  524. X; ascii returned in d0
  525. X_rawtoascii
  526. X    cmp.b    #79,d0
  527. X    bls.b    getascii    
  528. X    moveq.l    #0,d0
  529. X    rts
  530. Xgetascii
  531. X    lea    asciitable,a0
  532. X    move.b    0(a0,d0),d0
  533. X    rts
  534. X
  535. X
  536. X    section    asciitable,data
  537. X
  538. X; This is a quick trick, don't do this for anything other than
  539. X; home use, boys and girls.  Use rawkeyconvert, etc.
  540. X
  541. Xasciitable
  542. X    dc.b    '`'    ; backquote `
  543. X    dc.b    '1'
  544. X    dc.b    '2'
  545. X    dc.b    '3'
  546. X    dc.b    '4'
  547. X    dc.b    '5'
  548. X    dc.b    '6'
  549. X    dc.b    '7'
  550. X    dc.b    '8'
  551. X    dc.b    '9'
  552. X    dc.b    '0'
  553. X    dc.b    '-'
  554. X    dc.b    '='
  555. X    dc.b    $0D    ; \
  556. X    dc.b    0
  557. X    dc.b    '0'    ; keypad 0
  558. X    dc.b    'q'
  559. X    dc.b    'w'
  560. X    dc.b    'e'
  561. X    dc.b    'r'
  562. X    dc.b    't'
  563. X    dc.b    'y'
  564. X    dc.b    'u'
  565. X    dc.b    'i'
  566. X    dc.b    'o'
  567. X    dc.b    'p'
  568. X    dc.b    '['
  569. X    dc.b    ']'
  570. X    dc.b    0
  571. X    dc.b    '1'
  572. X    dc.b    '2'
  573. X    dc.b    '3'
  574. X    dc.b    'a'
  575. X    dc.b    's'
  576. X    dc.b    'd'
  577. X    dc.b    'f'
  578. X    dc.b    'g'
  579. X    dc.b    'h'
  580. X    dc.b    'j'
  581. X    dc.b    'k'
  582. X    dc.b    'l'
  583. X    dc.b    ';'
  584. X    dc.b    $27    ; ' single quote
  585. X    dc.b    0
  586. X    dc.b    0
  587. X    dc.b    '4'
  588. X    dc.b    '5'
  589. X    dc.b    '6'
  590. X    dc.b    0
  591. X    dc.b    'z'
  592. X    dc.b    'x'
  593. X    dc.b    'c'
  594. X    dc.b    'v'
  595. X    dc.b    'b'
  596. X    dc.b    'n'
  597. X    dc.b    'm'
  598. X    dc.b    ','
  599. X    dc.b    '.'
  600. X    dc.b    '/'
  601. X    dc.b    0
  602. X    dc.b    '.'    ; keypad
  603. X    dc.b    '7'
  604. X    dc.b    '8'
  605. X    dc.b    '9'
  606. X    dc.b    ' '
  607. X    dc.b    $8    ; backspace
  608. X    dc.b    $9    ; tab
  609. X    dc.b    $D    ; enter  cr
  610. X    dc.b    $D    ; return cr
  611. X    dc.b    $1B    ; ESC
  612. X    dc.b    $7f    ; delete
  613. X    dc.b    ''
  614. X    dc.b    0
  615. X    dc.b    0
  616. X    dc.b    '-'    ; keypad
  617. X    dc.b    0
  618. X    dc.b    0    
  619. X    dc.b    $b    ; up arrow
  620. X    dc.b    $a    ; down arrow
  621. X    dc.b    $20    ; rt arrow
  622. X    dc.b    $8    ; left arrow
  623. X    
  624. X    END
  625. END_OF_FILE
  626. if test 5691 -ne `wc -c <'serial.a'`; then
  627.     echo shar: \"'serial.a'\" unpacked with wrong size!
  628. fi
  629. # end of 'serial.a'
  630. fi
  631. if test -f 'st.c' -a "${1}" != "-c" ; then 
  632.   echo shar: Will not clobber existing file \"'st.c'\"
  633. else
  634. echo shar: Extracting \"'st.c'\" \(1882 characters\)
  635. sed "s/^X//" >'st.c' <<'END_OF_FILE'
  636. X/* ST.c : Serial Test */
  637. X/* Created by John Schultz, 4/16/90 */
  638. X/* Interrupt driven serial I/O testbed */
  639. X
  640. X#include <stdio.h>
  641. X#include <dos.h>
  642. X#include "input.h"
  643. X
  644. X#define CLOCK 3579545
  645. X
  646. X#define MINBAUD 300        /* Change these at will */
  647. X#define MAXBAUD 230000
  648. X
  649. X#define BUFFSIZE 80
  650. X
  651. X#define ESCAPE 69
  652. X
  653. Xextern void openserial(void);
  654. Xextern void __asm sendser(register __d0 char c);
  655. Xextern void __asm sendsernobuff(register __d0 char c);
  656. Xextern char __asm readser(void);
  657. Xextern short __asm checkser(void);
  658. Xextern char __asm rawtoascii(register __d0 char c);
  659. X
  660. Xextern short far baudper;
  661. X
  662. Xvoid main(int argc,char ** argv) {
  663. Xshort i = 0;
  664. Xlong console;
  665. Xlong baud;
  666. Xchar traw;
  667. Xshort notquit = 1;
  668. Xchar buffer[BUFFSIZE];
  669. X
  670. X
  671. X  if (argc != 2) {
  672. X    printf("USAGE: st <baud>\n");
  673. X    exit(0);
  674. X  }
  675. X
  676. X  baud = atoi(argv[1]);
  677. X  if (baud < MINBAUD)
  678. X    baud = MINBAUD;
  679. X  else if (baud > MAXBAUD)
  680. X    baud = MAXBAUD;
  681. X
  682. X  printf("Setting baud to %d. Press ESC to quit.\n",baud);
  683. X  
  684. X  baudper = (CLOCK / baud)-1;
  685. X
  686. X  console = _dopen("*",MODE_OLDFILE);
  687. X  if (console == -1) {
  688. X    printf("Couldn't open console.\n");
  689. X    exit(0);
  690. X  }
  691. X
  692. X  if (createti()) {
  693. X    openserial();
  694. X    traw = 0;
  695. X    raw = 0;
  696. X
  697. X    while (notquit) {
  698. X      if (raw) {
  699. X        traw = raw;
  700. X        raw = 0;
  701. X    if (traw == ESCAPE) notquit = 0;    /* ESC */
  702. X        traw = rawtoascii(traw);
  703. X        sendser(traw);
  704. X        sendser(traw);
  705. X        sendser(traw);
  706. X        sendser(traw);
  707. X        sendser(traw);
  708. X        sendser(traw);
  709. X        sendser(traw);
  710. X        sendser(traw);
  711. X        sendser(traw);
  712. X        sendser(traw);
  713. X
  714. X      }
  715. X
  716. X      if (checkser())
  717. X        for (i = 0;
  718. X            (i < BUFFSIZE) && (checkser());
  719. X            buffer[i++] = readser());
  720. X      
  721. X      if (i > 0) _dwrite(console,buffer,i);
  722. X
  723. X      i = 0;
  724. X
  725. X    } /* while notquit */
  726. X
  727. X    closeserial();
  728. X    deleteti();
  729. X  } /* if createti */
  730. X
  731. X  printf("\n");
  732. X
  733. X} /* END ST.c */
  734. END_OF_FILE
  735. if test 1882 -ne `wc -c <'st.c'`; then
  736.     echo shar: \"'st.c'\" unpacked with wrong size!
  737. fi
  738. # end of 'st.c'
  739. fi
  740. echo shar: End of archive 1 \(of 1\).
  741. cp /dev/null ark1isdone
  742. MISSING=""
  743. for I in 1 ; do
  744.     if test ! -f ark${I}isdone ; then
  745.     MISSING="${MISSING} ${I}"
  746.     fi
  747. done
  748. if test "${MISSING}" = "" ; then
  749.     echo You have the archive.
  750.     rm -f ark[1-9]isdone
  751. else
  752.     echo You still need to unpack the following archives:
  753.     echo "        " ${MISSING}
  754. fi
  755. ##  End of shell archive.
  756. exit 0
  757. -- 
  758. Mail submissions (sources or binaries) to <amiga@cs.odu.edu>.
  759. Mail comments to the moderator at <amiga-request@cs.odu.edu>.
  760. Post requests for sources, and general discussion to comp.sys.amiga.
  761.